#include <iostream>

using namespace std;

void FindTwoNumbersWithSum(int a[], int len, int n)
{
	int i = 0, j = len - 1;
	while(i < j)
	{
		while(a[j] > n - a[i]) j--;
		if(a[j] == n - a[i])
			cout<<a[i]<<" "<<a[j]<<endl;
		i++;
	}
}

int main()
{
	int a[6] = {1, 2, 4, 11, 13, 15};
	FindTwoNumbersWithSum(a, 6, 15);
}
